<?php
class CustomQuery {
    private $query = '';
    private $limit = 0;
    private $offset = 0;

    public function __construct($query) {
        $this->setQuery($query);
    }
    
    public function getQuery() {
        $query = $this->query;
        if($this->offset != 0) {
            $query .= ' limit ' . $this->offset;  
	        if($this->limit != 0) {
	            $query .= ", ". $this->limit;
	        }            
        } else {
            $query .= " limit ". $this->limit;
        }
        return $query;
    }
    
    public function setQuery($query) {
        $this->query = $query;
    }
    
    public function setLimit($limit) {
        $this->limit = $limit;
    }
    
    public function getLimit() {
        return $this->limit;
    }
    
    public function getOffset() {
        return $this->offset;
    }
    
    public function setOffset($offset) {
        $this->offset = $offset;
    }

}